package edu.udel.mboch.towerdefense;

import java.util.ArrayList;

public class HeavyTower extends Tower
{
	private static final long serialVersionUID = -2384958786868099116L;

	public HeavyTower(Position position)
	{
		super(position, 2);
		damage = 7;
		speed = 2000;
		range = 2;
		cost = Tower.HEAVY_COST;
		name = "Heavy Tower";
		timer = speed;
	}
	
	public HeavyTower(Position position, ArrayList<Position> positionsInRange)
	{
		super(position, positionsInRange, 2);
		damage = 5;
		speed = 1500;
		range = 2;
		cost = Tower.HEAVY_COST;
		name = "Heavy Tower";
	}
	
	@Override
	public void shoot(TDState state)
	{
		ArrayList<Mob> mobs = getMobsInRange(state);
		if(timer>speed && mobs.size() > 0)
		{
			for(Mob m : mobs)
			{
				state.getGrid().addProjectile(new Projectile(this, m));
			}
			while(timer>speed)
				timer%=speed;
		}
	}

	@Override
	public Tower copy()
	{
		return new HeavyTower(position.copy(), positionsInRange);
	}

	@Override
	public void print()
	{
		System.out.print("H");
	}

}
